package cn.com.api.mapper.base;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.*;

import cn.com.api.entity.U_article_cate;

//DAO
public interface U_article_cateMapperBase {

	// 根据id查看
	@Select("SELECT * FROM u_article_cate  WHERE id = #{id}")
	public U_article_cate findU_article_cateById(Integer id);

	// 查看数据集
	@Select("SELECT * FROM U_article_cate")
	public List<U_article_cate> findU_article_cates();

	// 添加
	@Insert("INSERT INTO u_article_cate (cate_id, article_id, creater_id, modified_by, modified_time, add_time) VALUES (#{cate_id}, #{article_id}, #{creater_id}, #{modified_by}, #{modified_time}, #{add_time})")
	@Options(useGeneratedKeys = true, keyProperty = "id")
	public int insertU_article_cate(U_article_cate u_article_cate);

	// 修改
	@Update("UPDATE u_article_cate SET cate_id = #{cate_id}, article_id = #{article_id}, creater_id = #{creater_id}, modified_by = #{modified_by}, modified_time = #{modified_time}, add_time = #{add_time} WHERE id = #{id}")
	public int updateU_article_cate(U_article_cate u_article_cate);

	// 删除
	@Delete("DELETE FROM u_article_cate  WHERE id = #{id}")
	public int deleteU_article_cate(Integer id);

	// Foreign keys revelant

	// region Indexs revelant

	// 获取根据article_id
	@Select("SELECT id, cate_id, article_id, creater_id, modified_by, modified_time, add_time FROM u_article_cate  WHERE article_id = #{article_id}")
	public List<U_article_cate> findU_article_catesByArticle_id(String article_id);

	// 获取根据cate_id
	@Select("SELECT id, cate_id, article_id, creater_id, modified_by, modified_time, add_time FROM u_article_cate  WHERE cate_id = #{cate_id}")
	public List<U_article_cate> findU_article_catesByCate_id(String cate_id);

}
